package com.fin.zw.aiqas.controller;

import com.fin.zw.aiqas.entity.LogInfo;
import com.fin.zw.aiqas.model.request.LogRequest;
import com.fin.zw.aiqas.service.LogInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/logInfo")
@Api(value = "日志操作管理", description = "日志操作管理")
public class LogInfoController {

    @Autowired
    private LogInfoService logInfoService;

    @GetMapping("/fetchPage")
    @ApiOperation(value = "查询所有的菜单信息", notes = "查询所有的菜单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", dataType = "int", paramType = "query", value = "页数 (0..N)"),
            @ApiImplicitParam(name = "size", dataType = "int", paramType = "query", value = "每页大小."),
            @ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query",
                    value = "依据什么排序: 属性名(,asc|desc). ")
    })
    public ResponseEntity<Page<LogInfo>> fetchPage(Pageable pageable, LogRequest request) {
        Page<LogInfo> page = logInfoService.queryLogInfo(pageable, request);
        return ResponseEntity.ok().body(page);
    }
}
